package actions;

import game.constants.ReferenceAction;
import interfaces.ActionInterface;
import interfaces.impl.Action;
import universe.Universe;
import extra.Position;

public class ActionSetPosition extends Action {
	
	Position position = null;

	@Override
	public ActionInterface cloneAction() {
		ActionSetPosition action = new  ActionSetPosition();
		action.modifyAction(this);
		return action;
	}

	@Override
	public boolean processActionChild(Universe universe) {
		if(position==null){
			return false;
			
		}
		target.setPosition(position);
		return true;
	}

	@Override
	public void initializeName() {
		name="Action set Position";
		
	}

	@Override
	public void initializeId() {
		id=ReferenceAction.ACTION_SET_POSITION;
		
	}

	@Override
	public void modifyChild(ActionInterface action) {
		if (action instanceof ActionSetPosition){
			position = ((ActionSetPosition) action).position;
		}
		
	}

	public Position getPosition() {
		return position;
	}

	public void setPosition(Position position) {
		this.position = position;
	}
	
	

}
